<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //声明一个类
    class Phone{
      //属性   作用: 为类的实例对象添加属性
      brand;
      price;
      color;
      name="手机"//声明时直接赋值
      call=()=>{
        console.log('正在通话中....');
      }
      //静态属性
      static test = '测试';

      //方法
      constructor(brand, price, color){
        this.brand = brand;
        this.price = price;
        this.color = color;
      }

      //打电话的功能
      call(someone){
        console.log(`正在给 ${someone} 打电话...`);
      }

      //静态方法
      static testRun(){
        console.log('run run run');
      }

    }

    console.dir(Phone);

    //声明一个子类 智能手机
    class SmartPhone extends Phone{
      //属性
      pixel;
      //构造方法
      constructor(brand, price, color, pixel){
        super(brand, price, color);
        //设置 pixel 的值
        this.pixel = pixel;
      }
    }

    //实例化对象
    // let mate60 = new Phone('华为', 5999, '雅丹青');
    // mate60.call('李晶');

    //实例化对象
    let mateX5 = new SmartPhone('华为', 12999, '幻影紫', '5000w');

    console.log(mateX5);

    function Test(){
      this.name = name;
      this.age = age;
      
    }
    Test.prototype.run = function(){

    }

  </script>
</body>
</html>